package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Permissionsset {
    private int psetId;
    private String psetName;
    private String psetIcon;
    private Collection<Menu> menusByPsetId;

    @Id
    @Column(name = "Pset_id")
    public int getPsetId() {
        return psetId;
    }

    public void setPsetId(int psetId) {
        this.psetId = psetId;
    }

    @Basic
    @Column(name = "Pset_name")
    public String getPsetName() {
        return psetName;
    }

    public void setPsetName(String psetName) {
        this.psetName = psetName;
    }

    @Basic
    @Column(name = "Pset_icon")
    public String getPsetIcon() {
        return psetIcon;
    }

    public void setPsetIcon(String psetIcon) {
        this.psetIcon = psetIcon;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Permissionsset that = (Permissionsset) o;
        return psetId == that.psetId &&
                Objects.equals(psetName, that.psetName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(psetId, psetName);
    }



    @OneToMany(mappedBy = "permissionssetByPsetId")
    public Collection<Menu> getMenusByPsetId() {
        return menusByPsetId;
    }

    public void setMenusByPsetId(Collection<Menu> menusByPsetId) {
        this.menusByPsetId = menusByPsetId;
    }
}
